<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Blog extends CI_Model {

	function __construct() {
		parent::__construct();
	}

	function get($limit, $offset) {
		$this->load->helper('typography');

		$this->db->select('pid,post_author,post_title,post_content,post_name,post_modified,post_type,comment_count,post_veiws');
		$this->db->order_by('post_modified desc');

		$result = $this->db->get('posts', $limit, $offset)->result();
		foreach ($result as $row){
			//$row->post_excerpt = auto_typography($row->post_excerpt, TRUE);
			$row->post_excerpt = auto_typography($row->post_content, TRUE);
		}
		return $result;
	}

	function count_all() {
		//$this->db->where('title', 'match');
		return $this->db->count_all_results('posts');
	}
}

/* End of file blog.php */
/* Location: ./application/models/blog.php */